//
//  UIView+FindNav.m
//
//  Created by mouxiaochun on 15/5/25.
//  Copyright (c) 2015年 MacMini. All rights reserved.
//

#import "UIView+FindNav.h"

@implementation UIView(FindNav)

- (UINavigationController *)navigationController
{
    UIViewController *vc = [self findViewController];
    return vc.navigationController;
}

- (UIViewController *)findViewController
{
    id target=self;
    while (target) {
        target = ((UIResponder *)target).nextResponder;
        if ([target isKindOfClass:[UIViewController class]])
            break;
    }
    return target;
}

@end
